﻿<Pages:ControlBase xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:historic="clr-namespace:Rio.Framework.Pages.Controls.Historic"
             x:Name="userControl"
             Unloaded="userControl_Unloaded"    
             x:Class="Rio.Framework.Pages.MenuOffice.HeadMenu"
             mc:Ignorable="d"
             xmlns:Pages="clr-namespace:Rio.Framework.Pages"
                   xmlns:converter="clr-namespace:Rio.Framework.Pages.AppCode.Helpers.Converter" 
                   d:DesignHeight="30"
             d:DesignWidth="1024">
    <UserControl.Resources>
        <telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <converter:ApplicationModeConverter x:Key="ApplicationModeConverter" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <telerik:RadToolBar GripVisibility="Collapsed"
                            OverflowButtonVisibility="Collapsed">
            <telerik:RadDropDownButton x:Name="homeDropDownButton"
                                       Width="30"
                                       DropDownIndicatorVisibility="Collapsed"
                                       ClickMode="Release">
                <Image Source="/Rio.Framework.Pages;component/Assets/Images/Home.png" />
                <telerik:RadDropDownButton.DropDownContent>
                    <Grid>
                        <Grid.Effect>
                            <DropShadowEffect Opacity="0.7" />
                        </Grid.Effect>
                        <Border BorderBrush="Gray"
                                BorderThickness="1">
                            <telerik:RadRibbonBackstage>
                                <telerik:RadRibbonBackstageItem IsSelectable="False"
                                                                Command="{Binding ApplicationCommand, ElementName=userControl, Mode=TwoWay}"
                                                                CommandParameter="home"
                                                                IsDefault="True">
                                    <telerik:RadRibbonBackstageItem.Header>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Assets/Images/home2.png"
                                                   Width="24" />
                                            <TextBlock Text="{Binding HomeButtonLabel, ElementName=userControl, Mode=TwoWay}"
                                                       VerticalAlignment="Center"
                                                       Margin="5,0,0,0" />
                                        </StackPanel>
                                    </telerik:RadRibbonBackstageItem.Header>
                                </telerik:RadRibbonBackstageItem>
                                <telerik:RadRibbonBackstageItem IsSelectable="False"
                                                                Command="{Binding ApplicationCommand, ElementName=userControl, Mode=TwoWay}"
                                                                CommandParameter="import"
                                                                Visibility="{Binding ImportIsEnabled, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=userControl, Mode=TwoWay}">
                                    <telerik:RadRibbonBackstageItem.Header>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Assets/Images/OfficePage/importation.png"
                                                   Width="28" />
                                            <TextBlock Text="{Binding ImportButtonLabel, ElementName=userControl, Mode=TwoWay}"
                                                       VerticalAlignment="Center"
                                                       Margin="5,0,0,0" />
                                        </StackPanel>
                                    </telerik:RadRibbonBackstageItem.Header>
                                </telerik:RadRibbonBackstageItem>
                                <telerik:RadRibbonBackstageItem IsSelectable="False"
                                                                Command="{Binding ApplicationCommand, ElementName=userControl, Mode=TwoWay}"
                                                                CommandParameter="search"
                                                                Visibility="{Binding SearchIsEnabled, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=userControl, Mode=TwoWay}">
                                    <telerik:RadRibbonBackstageItem.Header>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Assets/Images/OfficePage/consultation.png"
                                                   Width="34" />
                                            <TextBlock Text="{Binding SearchButtonLabel, ElementName=userControl}"
                                                       VerticalAlignment="Center"
                                                       Margin="5,0,0,0" />
                                        </StackPanel>
                                    </telerik:RadRibbonBackstageItem.Header>
                                </telerik:RadRibbonBackstageItem>
                                <telerik:RadRibbonBackstageItem IsSelectable="False"
                                                                Command="{Binding ApplicationCommand, ElementName=userControl, Mode=TwoWay}"
                                                                CommandParameter="flow"
                                                                Visibility="{Binding FlowIsEnabled, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=userControl, Mode=TwoWay}">
                                    <telerik:RadRibbonBackstageItem.Header>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Assets/Images/OfficePage/flow.png"
                                                   Width="26" />
                                            <TextBlock Text="{Binding FlowButtonLabel, ElementName=userControl, Mode=TwoWay}"
                                                       VerticalAlignment="Center"
                                                       Margin="5,0,0,0" />
                                        </StackPanel>
                                    </telerik:RadRibbonBackstageItem.Header>
                                </telerik:RadRibbonBackstageItem>
                                <telerik:RadRibbonBackstageItem IsSelectable="False"
                                                                Command="{Binding ApplicationCommand, ElementName=userControl, Mode=TwoWay}"
                                                                CommandParameter="manager"
                                                                Visibility="{Binding ManagerIsEnabled, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=userControl, Mode=TwoWay}">
                                    <telerik:RadRibbonBackstageItem.Header>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Assets/Images/OfficePage/manager.png"
                                                   Width="28" />
                                            <TextBlock Text="{Binding ManagerButtonLabel, ElementName=userControl, Mode=TwoWay}"
                                                       VerticalAlignment="Center"
                                                       Margin="5,0,0,0" />
                                        </StackPanel>
                                    </telerik:RadRibbonBackstageItem.Header>
                                </telerik:RadRibbonBackstageItem>
                                <telerik:RadRibbonBackstageItem IsSelectable="False"
                                                                Command="{Binding ApplicationCommand, ElementName=userControl, Mode=TwoWay}"
                                                                CommandParameter="configuration"
                                                                Visibility="{Binding ScanIsEnabled, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=userControl, Mode=TwoWay}">
                                    <telerik:RadRibbonBackstageItem.Header>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Assets/Images/Scanner.png"
                                                   Width="24" />
                                            <TextBlock Text="{Binding ScanButtonLabel, ElementName=userControl, Mode=TwoWay}"
                                                       VerticalAlignment="Center"
                                                       Margin="5,0,0,0" />
                                        </StackPanel>
                                    </telerik:RadRibbonBackstageItem.Header>
                                </telerik:RadRibbonBackstageItem>
                                <telerik:RadRibbonBackstageItem IsSelectable="False"
                                                                Command="{Binding ApplicationCommand, ElementName=userControl, Mode=TwoWay}"
                                                                CommandParameter="installation"
                                                                Visibility="{Binding ScanInstallIsEnabled, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=userControl, Mode=TwoWay}">
                                    <telerik:RadRibbonBackstageItem.Header>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Assets/Images/config.png"
                                                   Width="24" />
                                            <TextBlock Text="{Binding ScanInstallButtonLabel, ElementName=userControl, Mode=TwoWay}"
                                                       VerticalAlignment="Center"
                                                       Margin="5,0,0,0" />
                                        </StackPanel>
                                    </telerik:RadRibbonBackstageItem.Header>
                                </telerik:RadRibbonBackstageItem>
                                <telerik:RadRibbonBackstageItem CloseOnClick="False">
                                    <telerik:RadRibbonBackstageItem.Header>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Assets/Images/history_expander.png"
                                                   Width="24" />
                                            <TextBlock Text="{Binding HistoryButtonLabel, ElementName=userControl, Mode=TwoWay}"
                                                       VerticalAlignment="Center"
                                                       Margin="5,0,0,0" />
                                        </StackPanel>
                                    </telerik:RadRibbonBackstageItem.Header>

                                    <Grid>
                                        <historic:HistoricDashboard x:Name="historicDashboard"
                                                                    MaxHeight="600"
                                                                    MaxWidth="750" />
                                    </Grid>

                                </telerik:RadRibbonBackstageItem>
                                <telerik:RadRibbonBackstageItem IsSelectable="False"
                                                                Command="{Binding ApplicationCommand, ElementName=userControl, Mode=TwoWay}"
                                                                CommandParameter="disconnect">
                                    <telerik:RadRibbonBackstageItem.Header>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Assets/Images/Disconnect.png"
                                                   Width="22" />
                                            <TextBlock Text="{Binding DisconnectButtonLabel, ElementName=userControl, Mode=TwoWay}"
                                                       VerticalAlignment="Center"
                                                       Margin="5,0,0,0" />
                                        </StackPanel>
                                    </telerik:RadRibbonBackstageItem.Header>
                                </telerik:RadRibbonBackstageItem>
                            </telerik:RadRibbonBackstage>
                        </Border>
                    </Grid>
                </telerik:RadDropDownButton.DropDownContent>
            </telerik:RadDropDownButton>
            <telerik:RadButton x:Name="newMessagesButton"
                               Margin="20,0,0,0"
                               Visibility="Collapsed"
                               Command="{Binding ApplicationCommand, ElementName=userControl, Mode=TwoWay}"
                               CommandParameter="flow"
                               d:LayoutOverrides="Height">
                <StackPanel x:Name="newMessagesStackPanel"
                            Orientation="Horizontal">
                    <TextBlock TextWrapping="Wrap"
                               Text="{Binding NewMessagesCount, ElementName=userControl, Mode=TwoWay}"
                               VerticalAlignment="Center"
                               FontWeight="Bold"
                               Foreground="#FF9D0000" />
                    <Image Source="/Rio.Framework.Pages;component/Assets/Images/new_msg.png"
                           Margin="2,-2,0,0"
                           Width="24"
                           Height="24" />
                </StackPanel>
            </telerik:RadButton>
            <TextBlock x:Name="applicationNameLabel"
                       TextWrapping="Wrap"
                       VerticalAlignment="Center"
                       FontStyle="Italic"
                       Text="{Binding ApplicationName, Converter={StaticResource ApplicationModeConverter}, ElementName=userControl, Mode=TwoWay}"
                       Margin="20,0,0,0" />
            <TextBlock x:Name="usernameLabel"
                       TextWrapping="Wrap"
                       VerticalAlignment="Center"
                       FontStyle="Italic"
                       Text="{Binding CurrentUser.FullName, ElementName=userControl, Mode=TwoWay}"
                       Margin="20,0,0,0" />
        </telerik:RadToolBar>
    </Grid>
</Pages:ControlBase>
